package GUI;
import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.Font;
import java.sql.Date;

import javax.swing.JButton;
import javax.swing.JTextField;

import Entity.Order;

/**
 * this is the GUI for viewing a specific order.
 * @author Sandra Krasko
 *
 */
public class ViewOrder extends JFrame {

	private JPanel contentPane;
	private JTextField OrderIDText;
	private JTextField CustomerIDText;
	private JTextField CarNumberText;
	private JTextField OrderDateText;
	private JTextField ArrivalDateText;
	private JTextField LeavingDateText;
	private JTextField ParkingLotNumberText;
	private JTextField ActualArrivingDateText;
	private JTextField ActualLeavingDateText;
	private JTextField EmailText;

	/**
	 *  is the constructor. it just view the details for a single customer.
	 */
	public ViewOrder(Order myorder) {
		setTitle("View Order Window");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 587, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblOrderId = new JLabel("Order ID:");
		lblOrderId.setBounds(10, 30, 63, 14);
		contentPane.add(lblOrderId);
		
		JLabel lblCustimerId = new JLabel("Customer ID:");
		lblCustimerId.setBounds(10, 55, 88, 14);
		contentPane.add(lblCustimerId);
		
		JLabel lblViewOrder = new JLabel("View Order");
		lblViewOrder.setBounds(248, 11, 74, 14);
		lblViewOrder.setFont(new Font("Tahoma", Font.PLAIN, 14));
		contentPane.add(lblViewOrder);
		
		JLabel lblNewLabel = new JLabel("Order Date:");
		lblNewLabel.setBounds(10, 105, 88, 14);
		contentPane.add(lblNewLabel);
		
		JLabel lblCarNumber = new JLabel("Car Number:");
		lblCarNumber.setBounds(10, 80, 88, 14);
		contentPane.add(lblCarNumber);
		
		JButton btnNewButton = new JButton("Return");
		btnNewButton.setBounds(224, 214, 89, 23);
		contentPane.add(btnNewButton);
		
		JLabel lblArrivalDate = new JLabel("Arrival Date:");
		lblArrivalDate.setBounds(10, 130, 74, 14);
		contentPane.add(lblArrivalDate);
		
		JLabel lblParkingLotNumber = new JLabel("Parking Lot Number:");
		lblParkingLotNumber.setBounds(367, 55, 103, 14);
		contentPane.add(lblParkingLotNumber);
		
		JLabel lblLeavingDate = new JLabel("Leaving Date:");
		lblLeavingDate.setBounds(367, 30, 103, 14);
		contentPane.add(lblLeavingDate);
		
		JLabel lblActualArrivingDate = new JLabel("Actual Arriving Date:");
		lblActualArrivingDate.setBounds(367, 80, 124, 14);
		contentPane.add(lblActualArrivingDate);
		
		JLabel lblActualLeavingDate = new JLabel("Actual Leaving Date:");
		lblActualLeavingDate.setBounds(367, 105, 124, 14);
		contentPane.add(lblActualLeavingDate);
		
		JLabel lblEmail = new JLabel("Email:");
		lblEmail.setBounds(367, 130, 48, 14);
		contentPane.add(lblEmail);
		
		OrderIDText = new JTextField();
		OrderIDText.setBounds(83, 27, 86, 20);
		contentPane.add(OrderIDText);
		OrderIDText.setColumns(10);
		OrderIDText.setText(Integer.toString(myorder.getOrderID()));
		OrderIDText.setEditable(false);
		
		CustomerIDText = new JTextField();
		CustomerIDText.setBounds(83, 52, 86, 20);
		contentPane.add(CustomerIDText);
		CustomerIDText.setColumns(10);
		CustomerIDText.setText(myorder.getCustomerID());
		CustomerIDText.setEditable(false);
		
		CarNumberText = new JTextField();
		CarNumberText.setBounds(83, 77, 86, 20);
		contentPane.add(CarNumberText);
		CarNumberText.setColumns(10);
		CarNumberText.setText(myorder.getCarNumber());
		CarNumberText.setEditable(false);
		
		OrderDateText = new JTextField();
		OrderDateText.setBounds(83, 103, 86, 20);
		contentPane.add(OrderDateText);
		OrderDateText.setColumns(10);
		OrderDateText.setText(myorder.getOrderDate().toString());
		OrderDateText.setEditable(false);
		
		ArrivalDateText = new JTextField();
		ArrivalDateText.setBounds(83, 129, 86, 20);
		contentPane.add(ArrivalDateText);
		ArrivalDateText.setColumns(10);
		ArrivalDateText.setText(myorder.getArrivalDate().toString());
		ArrivalDateText.setEditable(false);
		
		LeavingDateText = new JTextField();
		LeavingDateText.setBounds(475, 27, 86, 20);
		contentPane.add(LeavingDateText);
		LeavingDateText.setColumns(10);
		LeavingDateText.setText(myorder.getLeavingDate().toString());
		LeavingDateText.setEditable(false);
		
		ParkingLotNumberText = new JTextField();
		ParkingLotNumberText.setBounds(475, 52, 86, 20);
		contentPane.add(ParkingLotNumberText);
		ParkingLotNumberText.setColumns(10);
		ParkingLotNumberText.setText(Integer.toString(myorder.getParkingLotNumber()));
		ParkingLotNumberText.setEditable(false);
		
		ActualArrivingDateText = new JTextField();
		ActualArrivingDateText.setBounds(475, 77, 86, 20);
		contentPane.add(ActualArrivingDateText);
		ActualArrivingDateText.setColumns(10);
		ActualArrivingDateText.setText(myorder.getActualArrivalDate().toString());
		ActualArrivingDateText.setEditable(false);
		
		ActualLeavingDateText = new JTextField();
		ActualLeavingDateText.setBounds(475, 103, 86, 20);
		contentPane.add(ActualLeavingDateText);
		ActualLeavingDateText.setColumns(10);
		ActualLeavingDateText.setText(myorder.getActualLeavingDate().toString());
		ActualLeavingDateText.setEditable(false);
		
		EmailText = new JTextField();
		EmailText.setBounds(475, 130, 86, 20);
		contentPane.add(EmailText);
		EmailText.setColumns(10);
		EmailText.setText(myorder.getEmail());
		EmailText.setEditable(false);
	}
}
